package com.bluefox.config;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;

@Slf4j
@Data
@Configuration
// 意思：当配置文件中只要出现rsa.private_key时，则该配置生效。
@ConditionalOnProperty(name = "rsa.private_key")
public class RsaProperties {

    public static String privateKey;

    @Value("${rsa.private_key}")
    public void setPrivateKey(String privateKey) {
        log.info("==============RsaProperties注入成功==============");
        RsaProperties.privateKey = privateKey;
    }
}
